﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using SharedCode;
using System.Collections.ObjectModel;
using AdminModule.IndexMarkServiceReference;

namespace AdminModule.ViewModels
{
    public class EditGradationWeightVM : ViewModelBase
    {
        private IndexMarkServiceClient client = new IndexMarkServiceClient();
        private ObservableCollection<AdmGradation> gradations = new ObservableCollection<AdmGradation>();
        public ObservableCollection<AdmGradation> Gradations
        {
            get
            {
                return this.gradations;
            }
            set
            {
                this.gradations = value;
            }
        }

        public override void Init()
        {
            base.Init();
            client.GetAdmGradationsCompleted += (s, ev) =>
                {
                    gradations.Clear();
                    gradations.LoadWithClear<AdmGradation>(ev.Result);
                    this.RaiseInitCompleted();
                };
            client.GetAdmGradationsAsync();
        }
    }
}
